//
//  DYManageVC.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/14.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYManageVC.h"
#import "DYManageCell.h"
#import "DYRechargeSetVC.h"
#import "DYVoucherVC.h"

@interface DYManageVC ()

@property (nonatomic,strong)NSArray *array;

@end

@implementation DYManageVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title=@"营销管理";
}
-(void)dy_initUI
{
    [super dy_initUI];
    
    self.tableView.backgroundColor=WhiteColor;
    [self.tableView registerClass:[DYManageCell class] forCellReuseIdentifier:@"DYManageCell"];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return BILIHEIGHT(60);
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    DYManageCell *cell=[tableView dequeueReusableCellWithIdentifier:@"DYManageCell" forIndexPath:indexPath];
    [cell getDic:self.array[indexPath.row]];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.row==0) {
        DYRechargeSetVC *vc=[[DYRechargeSetVC alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.row==1){
        DYRechargeSetVC *vc=[[DYRechargeSetVC alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.row==2){
        DYVoucherVC *vc=[[DYVoucherVC alloc]init];
        vc.navigationItem.title=@"代金券";
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.row==3){
        DYVoucherVC *vc=[[DYVoucherVC alloc]init];
        vc.navigationItem.title=@"免费赠品";
        [self.navigationController pushViewController:vc animated:YES];
    }
}

-(NSArray *)array
{
    if (!_array) {
        _array=[NSArray array];
        
        _array =@[@{@"image":@"icon_markzengs",@"title":@"充值赠送",@"content":@"优惠活动，充就送"},
                  @{@"image":@"icon_markyouh",@"title":@"充值优惠",@"content":@"优惠活动，折扣多多"},
                  @{@"image":@"icon_markquan",@"title":@"代金券",@"content":@"策划中，敬请期待"},
                  @{@"image":@"icon_markfree",@"title":@"免费赠品",@"content":@"策划中，敬请期待"}];
    }
    return _array;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
